text buffer: Fix compiler warnings
authorMatthias Clasen <mclasen@redhat.com>
Sun, 31 May 2015 01:28:30 +0000 (21:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 2 Jun 2015 13:08:15 +0000 (09:08 -0400)
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.

gtk/gtktextbtree.c
gtk/gtktextbufferrichtext.c

index 106191e0885b3d46a5e6c8f2923947787298e220..b53e5f0df00c971d4b389192eac1aa7d3e041545 100644 (file)
@@ -5792,7 +5792,7 @@ gtk_text_btree_rebalance (GtkTextBTree *tree,
           GtkTextBTreeNode *other;
           GtkTextBTreeNode *halfwaynode = NULL; /* Initialization needed only */
           GtkTextLine *halfwayline = NULL; /* to prevent cc warnings. */
-          int total_children, first_children, i;
+          int total_children, first_children;
 
           /*
            * Too few children for this GtkTextBTreeNode.  If this is the root then,
@@ -5861,46 +5861,46 @@ gtk_text_btree_rebalance (GtkTextBTree *tree,
             }
           if (node->level == 0)
             {
-              GtkTextLine *line;
+              GtkTextLine *line2;
 
-              for (line = node->children.line, i = 1;
-                   line->next != NULL;
-                   line = line->next, i++)
+              for (line2 = node->children.line, i = 1;
+                   line2->next != NULL;
+                   line2 = line2->next, i++)
                 {
                   if (i == first_children)
                     {
-                      halfwayline = line;
+                      halfwayline = line2;
                     }
                 }
-              line->next = other->children.line;
+              line2->next = other->children.line;
               while (i <= first_children)
                 {
-                  halfwayline = line;
-                  line = line->next;
+                  halfwayline = line2;
+                  line2 = line2->next;
                   i++;
                 }
             }
           else
             {
-              GtkTextBTreeNode *child;
+              GtkTextBTreeNode *child2;
 
-              for (child = node->children.node, i = 1;
-                   child->next != NULL;
-                   child = child->next, i++)
+              for (child2 = node->children.node, i = 1;
+                   child2->next != NULL;
+                   child2 = child2->next, i++)
                 {
                   if (i <= first_children)
                     {
                       if (i == first_children)
                         {
-                          halfwaynode = child;
+                          halfwaynode = child2;
                         }
                     }
                 }
-              child->next = other->children.node;
+              child2->next = other->children.node;
               while (i <= first_children)
                 {
-                  halfwaynode = child;
-                  child = child->next;
+                  halfwaynode = child2;
+                  child2 = child2->next;
                   i++;
                 }
             }
index c888a98cf4041db59772fc4a28fc239cb0529100..0132ea9536148fd598fb2e920599b181baa241f7 100644 (file)
@@ -543,8 +543,8 @@ gtk_text_buffer_deserialize (GtkTextBuffer  *register_buffer,
                              gsize           length,
                              GError        **error)
 {
-  GList    *formats;
-  GList    *list;
+  GList *formats;
+  GList *l;
 
   g_return_val_if_fail (GTK_IS_TEXT_BUFFER (register_buffer), FALSE);
   g_return_val_if_fail (GTK_IS_TEXT_BUFFER (content_buffer), FALSE);
@@ -554,12 +554,11 @@ gtk_text_buffer_deserialize (GtkTextBuffer  *register_buffer,
   g_return_val_if_fail (length > 0, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-  formats = g_object_get_qdata (G_OBJECT (register_buffer),
-                                deserialize_quark ());
+  formats = g_object_get_qdata (G_OBJECT (register_buffer), deserialize_quark ());
 
-  for (list = formats; list; list = g_list_next (list))
+  for (l = formats; l; l = l->next)
     {
-      GtkRichTextFormat *fmt = list->data;
+      GtkRichTextFormat *fmt = l->data;
 
       if (fmt->atom == format)
         {